package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.TmallEaiBaseGatewayRegisterResponse;

/**
 * TOP API: tmall.eai.base.gateway.register request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class TmallEaiBaseGatewayRegisterRequest implements TaobaoRequest<TmallEaiBaseGatewayRegisterResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 用户应用的回调URL,若是普通OPEN-API用户(user_type=0)这个字段可以不填。但是若是JIP用户注册，也就是(user_type=
   * 1)时,则此字段必填。否则调用不会成功。
   */
  private String              callBackUrl;

  /**
   * 字符集编码GBK,UTF-8默认,GB2312
   */
  private String              charSet;

  /**
   * 用户所在的城市
   */
  private String              city;

  /**
   * 数据格式:XML,JSON。 默认:JSON
   */
  private String              contentType;

  /**
   * 接入方式描述，为了更好的方便我们为您服务请务必详细描述下您的APP情况。
   */
  private String              description;

  /**
   * 用户所在区域
   */
  private String              district;

  /**
   * 用户的联系邮箱
   */
  private String              email;

  /**
   * 暂时还没有支持
   */
  private Long                maxFlow;

  /**
   * 用户手机号码
   */
  private String              mobile;

  /**
   * 用户通知接收方式,邮件,电话或者其他。 email:邮件; message:短信; aliwangwang:阿里旺旺弹出消息。
   */
  private String              notifyType;

  /**
   * 联系人姓名
   */
  private String              principal;

  /**
   * 用户联系电话-座机
   */
  private String              telephone;

  /**
   * 接口/api名称: 天猫退款消息可选值为: tmall.eai.order.refund.refundBill.push
   * tmall.eai.order.refund.refundStatus.push
   */
  private String              topic;

  /**
   * Topic组.暂时还不能支持.
   */
  private String              topicGroup;

  /**
   * url协议 HTTP默认
   */
  private String              urlProtocal;

  /**
   * 0:普通TOP-OPEN-API用户; 1:JIP用户。
   */
  private Long                userType;

  public void setCallBackUrl(String callBackUrl) {
    this.callBackUrl = callBackUrl;
  }

  public String getCallBackUrl() {
    return this.callBackUrl;
  }

  public void setCharSet(String charSet) {
    this.charSet = charSet;
  }

  public String getCharSet() {
    return this.charSet;
  }

  public void setCity(String city) {
    this.city = city;
  }

  public String getCity() {
    return this.city;
  }

  public void setContentType(String contentType) {
    this.contentType = contentType;
  }

  public String getContentType() {
    return this.contentType;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getDescription() {
    return this.description;
  }

  public void setDistrict(String district) {
    this.district = district;
  }

  public String getDistrict() {
    return this.district;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getEmail() {
    return this.email;
  }

  public void setMaxFlow(Long maxFlow) {
    this.maxFlow = maxFlow;
  }

  public Long getMaxFlow() {
    return this.maxFlow;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }

  public String getMobile() {
    return this.mobile;
  }

  public void setNotifyType(String notifyType) {
    this.notifyType = notifyType;
  }

  public String getNotifyType() {
    return this.notifyType;
  }

  public void setPrincipal(String principal) {
    this.principal = principal;
  }

  public String getPrincipal() {
    return this.principal;
  }

  public void setTelephone(String telephone) {
    this.telephone = telephone;
  }

  public String getTelephone() {
    return this.telephone;
  }

  public void setTopic(String topic) {
    this.topic = topic;
  }

  public String getTopic() {
    return this.topic;
  }

  public void setTopicGroup(String topicGroup) {
    this.topicGroup = topicGroup;
  }

  public String getTopicGroup() {
    return this.topicGroup;
  }

  public void setUrlProtocal(String urlProtocal) {
    this.urlProtocal = urlProtocal;
  }

  public String getUrlProtocal() {
    return this.urlProtocal;
  }

  public void setUserType(Long userType) {
    this.userType = userType;
  }

  public Long getUserType() {
    return this.userType;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "tmall.eai.base.gateway.register";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("call_back_url", this.callBackUrl);
    txtParams.put("char_set", this.charSet);
    txtParams.put("city", this.city);
    txtParams.put("content_type", this.contentType);
    txtParams.put("description", this.description);
    txtParams.put("district", this.district);
    txtParams.put("email", this.email);
    txtParams.put("max_flow", this.maxFlow);
    txtParams.put("mobile", this.mobile);
    txtParams.put("notify_type", this.notifyType);
    txtParams.put("principal", this.principal);
    txtParams.put("telephone", this.telephone);
    txtParams.put("topic", this.topic);
    txtParams.put("topic_group", this.topicGroup);
    txtParams.put("url_protocal", this.urlProtocal);
    txtParams.put("user_type", this.userType);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<TmallEaiBaseGatewayRegisterResponse> getResponseClass() {
    return TmallEaiBaseGatewayRegisterResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(callBackUrl, "callBackUrl");
    RequestCheckUtils.checkNotEmpty(city, "city");
    RequestCheckUtils.checkNotEmpty(description, "description");
    RequestCheckUtils.checkNotEmpty(email, "email");
    RequestCheckUtils.checkNotEmpty(mobile, "mobile");
    RequestCheckUtils.checkNotEmpty(principal, "principal");
    RequestCheckUtils.checkNotEmpty(topic, "topic");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
